#include <utl/io.h>
#include <stdio.h>

namespace utl
{
    bool read_file(const char *path, filebytes &storage)
    {
        FILE *fp{fopen(path, "rb")};
        if (fp == nullptr)
        {
            return false;
        }
        fseek(fp, 0, SEEK_END);
        auto file_size = ftell(fp);
        storage.resize(file_size);
        fseek(fp, 0, SEEK_SET);
        fread(storage.data(), sizeof(filebytes::value_type), file_size, fp);
        fclose(fp);
        return storage.size() > 0;
    }

} // namespace utl